import Vue from 'vue'
import Router from 'vue-router'


import Manager from '@/components/hotelManager/Manager'
// 引用pages
import checkInAndOutMgmt from '@/components/hotelManager/checkInAndOutMgmt'
import roomMgmt from '@/components/hotelManager/roomMgmt'
import historyRecord from '@/components/hotelManager/historyRecord'
import incomeStatistics from '@/components/hotelManager/incomeStatistics'
import index from '@/components/hotelManager/Index'
import userManage from '@/components/hotelManager/userManage'
import adminManage from '@/components/hotelManager/adminManage'
import getOrdersExcels from '@/components/hotelManager/getOrdersExcels'

import s0 from '@/components/hotelManager/orderStatus/s0'
import s1 from '@/components/hotelManager/orderStatus/s1'
import s2 from '@/components/hotelManager/orderStatus/s2'
import s3 from '@/components/hotelManager/orderStatus/s3'

import userIndex from '@/components/userView/userIndex';
import home from '@/components/userView/home';
import rooms from '@/components/userView/rooms';
import myself from '@/components/userView/myself';
import gallery from '@/components/userView/gallery';


import baseSetting from '@/components/userView/settings/baseSetting';
import orderChange from '@/components/userView/settings/OrderChange';
import binding from '@/components/userView/settings/binding';
import information from '@/components/userView/settings/information';
import other from '@/components/userView/settings/other';

import updatePassword from '@/components/userView/settings/update/updatePassword';
import updateEmail from '@/components/userView/settings/update/updateEmail';
import updateRealName from '@/components/userView/settings/update/updateRealName';
import roomSource from '@/components/hotelManager/roomSource';
Vue.use(Router)

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default new Router({
    routes: [
        // {
        //   path: '/',
        //   redirect: '/HelloWorld'
        // },


        {
            path: '/',
            name: 'userIndex',
            component: userIndex
        },
        {
            path: '/hotelManager/Manager',
            name: 'Manager',
            component: Manager,
            children: [
                {
                    path: '/hotelManager/getOrdersExcels',
                    name: 'getOrdersExcels',
                    component: getOrdersExcels
                },
                {
                    path: '/hotelManager/checkInAndOutMgmt',
                    name: 'checkInAndOutMgmt',
                    component: checkInAndOutMgmt
                },
                {
                    path: '/hotelManager/historyRecord',
                    name: 'historyRecord',
                    component: historyRecord
                },
                {
                    path: '/hotelManager/incomeStatistics',
                    name: 'incomeStatistics',
                    component: incomeStatistics
                },
                {
                    path: '/hotelManager/roomMgmt',
                    name: 'roomMgmt',
                    component: roomMgmt
                },
                {
                    path: '/hotelManager/index',
                    name: 'index',
                    component: index
                },
                {
                    path: '/hotelManager/userManage',
                    name: 'userManage',
                    component: userManage
                },
                {
                    path: '/hotelManager/adminManage',
                    name: 'adminManage',
                    component: adminManage
                },
                {
                    path: '/hotelManager/roomSource',
                    name: 'roomSource',
                    component: roomSource
                },
                {
                    path: '/hotelManager/s0',
                    name: 's0',
                    component: s0
                },
                {
                    path: '/hotelManager/s1',
                    name: 's1',
                    component: s1
                },
                {
                    path: '/hotelManager/s2',
                    name: 's2',
                    component: s2
                },
                {
                    path: '/hotelManager/s3',
                    name: 's3',
                    component: s3
                }
            ]
        },
        {
            path: '/userView/userIndex',
            name: 'userIndex',
            component: userIndex,
            children: [{
                    path: '/userView/home',
                    name: 'home',
                    component: home
                },
                {
                    path: '/userView/rooms',
                    name: 'rooms',
                    component: rooms
                },
                {
                    path: '/userView/myself',
                    name: 'myself',
                    component: myself,
                    children: [{
                            path: '/userView/myself/baseSetting',
                            name: 'baseSetting',
                            component: baseSetting
                        },
                        {
                            path: '/userView/myself/orderChange',
                            name: 'orderChange',
                            component: orderChange
                        },
                        {
                            path: '/userView/myself/binding',
                            name: 'binding',
                            component: binding
                        },
                        {
                            path: '/userView/myself/information',
                            name: 'information',
                            component: information
                        },
                        {
                            path: '/userView/myself/other',
                            name: 'other',
                            component: other
                        },
                        {
                            path: '/userView/myself/updatePassword',
                            name: 'updatePassword',
                            component: updatePassword
                        },
                        {
                            path: '/userView/myself/updateEmail',
                            name: 'updateEmail',
                            component: updateEmail
                        },
                        {
                            path: '/userView/myself/updateRealName',
                            name: 'updateRealName',
                            component: updateRealName
                        }
                    ]
                },
                {
                    path: '/userView/gallery',
                    name: 'gallery',
                    component: gallery
                }
            ]
        }
    ]
})